<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/laypublic.jsp" %>
<%@ include file="../include/vueComponent.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>立项申请详情</title>
</head>
<link rel="stylesheet" href="${ctx}/resources/vue-element-lib/detail.css">
<style>
    .list {
        margin-bottom: 30px;
    }

    .list > .item {
        border: 1px solid rgb(229, 229, 229);
        position: relative;
        padding: 30px 0;
    }

    .item_add {
        width: 87.5%;
        display: flex;
        justify-content: flex-end;
        margin-bottom: 10px;
    }

    .list > .item > img {
        position: absolute;
        left: 30px;
        top: 50%;
        transform: translate(-0%, -50%); /* 50%为自身尺寸的一半 */
        z-index: 999;
    }
</style>
<body>
<div id="app">
    <div class="layui-tab layui-tab-brief" lay-filter="xqxx-tab-all">
        <ul class="layui-tab-title">
            <li id="tbglId" class="layui-this" lay-id="0">
                立项申请详情
            </li>
            <%--            <li id="zgysId" lay-id="1">历史审批信息</li>--%>
        </ul>
        <div class="layui-tab-right">
            <c:if test="${isAuditFlag eq '1'}">
                <template v-if="layId==0">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" @click="save(1)">保存
                    </button>
                    <button type="button" class="layui-btn layui-btn-radius" @click="save(2)">提交</button>
                </template>
            </c:if>
            <c:if test="${auditTabFlag eq '1'}">
                <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" @click="audit(0)">
                    不同意
                </button>
                <button type="button" class="layui-btn layui-btn-radius" @click="audit(1)">同意</button>
            </c:if>
        </div>
        <div class="layui-tab-content" style="height: 100px;">
            <div class="layui-tab-item layui-show">
                <div class="container">
                    <el-form ref="formRef" label-width="180px" label-suffix="："
                             label-position="left">
                        <div class="title">
                            <h3>项目基础信息</h3>
                        </div>
                        <el-row>
                            <x-col>
                                <el-form-item label="项目名称">
                                    <span v-if="id">{{info.proName}}</span>
                                    <x-input v-else v-model="info.proName" name="项目名称"></x-input>
                                </el-form-item>
                            </x-col>
                            <x-col position="right">
                                <el-form-item label="项目编码">
                                    <span>{{info.proCode}}</span>
                                </el-form-item>
                            </x-col>
                        </el-row>
                        <el-row>
                            <x-col position="full">
                                <el-form-item label="项目地点" :rules="[{ required: true}]">
                                    <el-select v-model="info.refProvinceId" style="width: 100px" filterable
                                               placeholder="请选择" @change="selProvince" :disabled="id?true:false">
                                        <el-option v-for="item in province" :key="item.id" :label="item.sname"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                    <el-select v-model="info.refCityId" style="width: 100px;margin-left: 20px"
                                               filterable placeholder="请选择" @change="selCity" :disabled="id?true:false">
                                        <el-option v-for="item in city" :key="item.id" :label="item.sname"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                    <el-select v-model="info.refAreaId" style="width: 100px;margin-left: 20px"
                                               filterable placeholder="请选择" :disabled="id?true:false">
                                        <el-option v-for="item in area" :key="item.id" :label="item.sname"
                                                   :value="item.id"></el-option>
                                    </el-select>
                                </el-form-item>
                            </x-col>

                        </el-row>
                        <div class="title">
                            <h3>项目融资信息</h3>
                        </div>
                        <div class="list">
                            <div class="item_add">
                                <button class="layui-btn layuiadmin-btn-admin" type="button" data-type="add"
                                        @click="add">
                                    <i class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>添加金融机构
                                </button>
                            </div>
                            <div class="item" v-for="(item,index) in setupFinancials">
                                <img src="${ctx}/resources/images/del.png" @click="del(index)"
                                     v-if="setupFinancials&&setupFinancials.length>1">
                                <el-row>
                                    <x-col>
                                        <el-form-item :label="'金融机构1'+(index+1)">
                                            <el-select v-model="item.finOrg" placeholder="请选择" style="width: 100%"
                                                       v-if="lookInfoBank.length>0">
                                                <el-option v-for="item1 in lookInfoBank" :key="item1.id"
                                                           :label="item1.dockBank" :value="item1.id"></el-option>
                                            </el-select>
                                            <x-input v-model="item.finOrg" name="金融机构" v-else/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="金融类型">
                                            <x-select v-model="item.capType" :options="financialType"
                                                      name="金融类型"></x-select>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="融资负责人">
                                            <x-input v-model="item.leader" name="融资负责人"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="融资主体">
                                            <x-input v-model="item.sgCoopId" name="融资主体"/>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="融资方式">
                                            <x-select v-model="item.financingType" :options="financialStyle"
                                                      name="融资方式"></x-select>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="贷款类型">
                                            <x-select v-model="item.loanType" :options="loan"
                                                      name="贷款类型"></x-select>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="融资金额(万元)">
                                            <x-input v-model="item.capAmount" min="0" type="number" type="number"
                                                     min="0" name="融资金额"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="融资期限(年)">
                                            <x-input v-model="item.timeLimit" min="0" type="number" type="number"
                                                     min="0" name="融资期限"/>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="合同融资成本(万元)">
                                            <x-input v-model="item.capCost" min="0" type="number" name="合同融资成本"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="综合成本(万元)">
                                            <x-input v-model="item.multiCost" min="0" type="number" name="综合成本"/>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="还款方式">
                                            <x-input v-model="item.repayType" name="还款方式"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="附加条件">
                                            <x-input v-model="item.needMemo" name="附加条件"/>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="增信方式">
                                            <x-input v-model="item.bailMode" name="增信方式"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="资金用途">
                                            <x-input v-model="item.capitalType" name="资金用途"/>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col>
                                        <el-form-item label="还款来源">
                                            <x-input v-model="item.repaySource" name="还款来源"/>
                                        </el-form-item>
                                    </x-col>
                                    <x-col position="right">
                                        <el-form-item label="预计到账日期">
                                            <el-date-picker style="width: 100%" v-model="item.willArrivalDate"
                                                            type="date"
                                                            placeholder="选择预计到账日期"
                                                            value-format="yyyy-MM-dd"></el-date-picker>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                                <el-row>
                                    <x-col position="full">
                                        <el-form-item label="资金监管要求">
                                            <x-input v-model="item.requires" type="textarea" :rows="4"
                                                     name="资金监管要求"></x-input>
                                        </el-form-item>
                                    </x-col>
                                </el-row>
                            </div>
                        </div>
                        <%-- <div class="title">
                             <h3>审批意见</h3>
                         </div>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="经办人意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="经办人意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="融资团队负责人意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="融资团队负责人意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="分管副总裁意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="分管副总裁意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="总裁意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="总裁意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="副董事长意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="副董事长意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="董事长意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="董事长意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>
                         <el-row>
                             <x-col position="full">
                                 <el-form-item label="集团融资管理中心意见">
                                     <x-input v-model="value" type="textarea" :rows="4" name="集团融资管理中心意见"></x-input>
                                 </el-form-item>
                             </x-col>
                         </el-row>--%>
                    </el-form>
                    <c:if test="${auditTabFlag eq '1'}">
                        <div class="title">
                            <h3>审批信息</h3>
                        </div>
                        <%@ include file="process/process-audit.jsp" %>
                    </c:if>
                </div>
            </div>
            <div class="layui-tab-item">
                <%--                <%@ include file="process/process-history.jsp" %>--%>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/resources/vue-element-lib/jquery.js"></script>
<script>
    var fileArr = [];
    var staticPath = '${fileHttpPre}';
    layui.config({
        base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set', 'upload', 'table', 'transfer', 'laydate', 'element', 'layer'], function () {
        var $ = layui.$
            , upload = layui.upload
            , table = layui.table
            , element = layui.element
            , layer = layui.layer;

        //选项卡切换监听
        element.on('tab(xqxx-tab-all)', function (data) {
            var layId = $(this).attr('lay-id');
            vm.$data.layId = layId;
            if (layId === "0") {

            } else if (layId === "1") {
                loadTable(layId);
            }
        });

        function loadTable(layId) {
            // 表单
            table.render({
                elem: '#lay-lsspxx-create-manage'
                , url: basePath + '/historyProcess/list?proCode=${proCode}'
                , cols: [[
                    {
                        field: 'startTime', title: '发起时间', width: 145, width: 155, templet: function (d) {
                            return layui.util.toDateString(d.startTime, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                    , {field: 'startRealName', title: '发起人', width: 145}
                    , {field: 'proFlowType', title: '审批阶段', width: 145}
                    , {field: 'proFlowNode', title: '审批节点', width: 145}
                    , {
                        field: 'dealTime', title: '审批日期', width: 155, templet: function (d) {
                            return layui.util.toDateString(d.dealTime, "yyyy-MM-dd HH:mm:ss");
                        }
                    }
                    , {field: 'dealName', title: '审批人', width: 160}
                    , {
                        field: 'state', title: '审批状态'
                    }
                    , {
                        title: '操作', width: 140, align: 'center', fixed: 'right', templet: function (d) {
                            var optStr = "";
                            optStr += '<a class="layui-btn layui-btn-xs" lay-event="view"><i class="layui-icon layui-icon-form"></i>查看</a>';
                            return optStr;
                        }
                    }
                ]]
                , page: true
                , limit: 10
            });

            // 监听操作列
            table.on('tool(lay-lsspxx-create-manage)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {//查看
                    parent.layui.index.openTabsPage(basePath + '/historyProcess/toDetail?processId=' + data.processId, '历史流程信息 > 详情');
                }
            });
        }

        //多文件列表示例
        ;(function () {
            //定义构造函数
            var Upfile = function (ele, type, opt) {
                this.defaults = {
                    //elem:‘#uploadPic‘	//绑定元素
                    elem: $(ele)	//绑定元素
                    , url: basePath + '/contractInfo/uploadAtt/',
                    data: {
                        types: type
                    },
                    multiple: true,
                    accept: 'file',
                    acceptMime: 'application/zip,application/x-rar-compressed,image/jpeg,image/png,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/pdf',

                    method: 'post',
                    before: function (obj) { //obj参数包含的信息
                        layer.load(); //上传loading
                    },
                    done: function (res) {
                        //如果上传失败
                        if (res.code > 0) {
                            layer.closeAll('loading'); //关闭loading
                            return layer.msg(res.msg, {icon: 7});
                        }
                        //上传完毕
                        if (res.entity != null && res.entity.length > 0) {
                            fileArr.push(res.entity[0])
                            for (var i in res.entity) {
                                var contractInfo = res.entity[i];
                                var arr = contractInfo.split("|");
                                var imgSrc = "";
                                var suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                                if (suffix == 'jpg' || suffix == 'png') {
                                    imgSrc = "${fileHttpPre}/" + arr[3];
                                } else {
                                    imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                                }
                                $('#' + type + '-upload-more-list')
                                    .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                        + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                        + arr[3] + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                        + arr[2] + '\')";>删除</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                        + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                            }
                        }
                    },
                    allDone: function (obj) { //当文件全部被提交后，才触发
                        layer.closeAll('loading'); //关闭loading
                    },
                    error: function () {
                        layer.closeAll('loading'); //关闭loading
                        //上传失败
                        layer.msg("上传失败，请稍后再试~", {icon: 7});
                    }
                }
                this.options = $.extend({}, this.defaults, opt);
            };

            //定义方法
            Upfile.prototype = {
                init: function () {
                    var _this = this;
                    return layui.use('upload', function () {
                        var upload = layui.upload;

                        //执行实例
                        var uploadInst = upload.render(_this.options);
                    });
                }
            };

            //在插件中使用对象
            $.fn.upfile = function (options) {
                var upfile = new Upfile(this, options);
                return upfile.init();
            }
        })();
        //上传文件
        $('#27-upload-more').upfile(27);
    });

    //删除文件
    function del(index) {
        layui.$("#fileAtt_" + index).remove();
        layui.$("#upload_img_" + index).remove();
        fileArr.map((el, idx) => {
            if (el.split('|')[2] == index) {
                fileArr.splice(idx, 1)
            }
        })
    }

    //根据url查看文件
    function showImg(url) {
        var openWin = window.open(url, '', 'left=410,height=768, width=1024, top=200,  toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
    }

    /*核心*/
    var vm = new Vue({
        el: '#app',
        data() {
            return {
                id: '',
                processId: '',
                procNodeList: [],
                tempNodeList: [],
                auditMsg: '',//审批意见


                proCode: '',
                layId: 0,
                info: {
                    proCode: '',
                    proName: '',
                    refAreaId: '',
                    refCityId: '',
                    refProvinceId: '',
                },
                province: [],//省
                city: [],//市
                area: [],//区
                financialStyle: [],//融资方式
                loan: [],//贷款类型
                financialType: [],//金融类型
                lookInfoBank: [],//金融机构
                projectType: [],
                setupFinancials: [],
            }
        },
        created() {
            this.id = "${id}";
            this.proCode = "${proCode}";
            this.processId = "${processId}";
            this.queryDrop();
            this.queryProcessList()
        },
        mounted() {

        },
        methods: {
            selProvince(id) {
                this.city = [];
                this.area = [];
                this.info.refCityId = '';//市 id
                this.info.refAreaId = '';//区id
                this.info.proAddress = '';//详细地址
                this.getAddress(id, 1, 'city');//获取地址
            },
            selCity(id) {
                this.area = [];
                this.info.refAreaId = '';//区id
                this.info.proAddress = '';//详细地址
                this.getAddress(id, 2, 'area');//获取地址
            },
            getAddress(id, type = 0, name) {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/collectProject/getAddress',  //请求数据接口
                    data: {
                        id: (id ? id + ',' : '') + (type ? type : '0')
                    },
                    success: function (result) {
                        // if (typeId) {
                        that[name] = result.entity;
                        // arr.map(el => {
                        //     if (el.id == typeId) {
                        //         that[name] = el.sname;
                        //     }
                        // })
                        // }
                    }
                });
            },
            add() {
                let obj = {
                    finOrg: '',//金融机构1
                    capType: '',//金融类型
                    leader: '',//融资负责人
                    sgCoopId: '',//融资主体
                    financingType: '',//融资方式
                    loanType: '',//贷款类型
                    capAmount: '',//融资金额
                    timeLimit: '',//融资期限
                    capCost: '',//合同融资成本
                    multiCost: '',//综合成本
                    repayType: '',//还款方式
                    needMemo: '',//附加条件
                    bailMode: '',//增信方式
                    capitalType: '',//资金用途
                    repaySource: '',//还款来源
                    willArrivalDate: '',//预计到账日期
                    requires: '',//资金监管要求
                }
                this.setupFinancials.push(obj)
            },
            del(index) {
                this.setupFinancials.splice(index, 1)
            },
            getSetupNew() {
                let that = this
                $.ajax({
                    type: 'post',
                    url: basePath + '/setupFin/getSetupNew',
                    data: {proCode: that.proCode},
                    success: function (result) {
                        that.info.proCode = result.entity.proCode
                    }
                });
            },
            queryDrop() {
                let that = this
                $.ajax({
                    type: 'post',
                    url: basePath + '/setupFin/queryDrop',
                    data: {proCode: that.proCode},
                    success: function (result) {
                        that.financialStyle = result.entity.financialStyle;
                        that.financialType = result.entity.financialType;
                        that.loan = result.entity.loan;
                        that.lookInfoBank = result.entity.lookInfoBank || [];
                        if (that.id) {
                            that.querySetupFin();
                            that.queryProcessList();
                        } else {
                            that.getAddress('', '', 'province');
                            that.getSetupNew();
                            that.setupFinancials = [];
                            let obj = {
                                finOrg: '',//金融机构1
                                capType: '',//金融类型
                                leader: '',//融资负责人
                                sgCoopId: '',//融资主体
                                financingType: '',//融资方式
                                loanType: '',//贷款类型
                                capAmount: '',//融资金额
                                timeLimit: '',//融资期限
                                capCost: '',//合同融资成本
                                multiCost: '',//综合成本
                                repayType: '',//还款方式
                                needMemo: '',//附加条件
                                bailMode: '',//增信方式
                                capitalType: '',//资金用途
                                repaySource: '',//还款来源
                                willArrivalDate: '',//预计到账日期
                                requires: '',//资金监管要求
                            }
                            that.setupFinancials.push(obj)
                        }
                    }
                });
            },
            querySetupFin() {
                let that = this
                $.ajax({
                    type: 'post',
                    url: basePath + '/setupFin/querySetupFin',
                    data: {id: that.id},
                    success: function (result) {
                        if (result.success) {
                            that.info = result.entity;
                            that.setupFinancials = that.info.setupFinancials;
                            that.getAddress('', '', 'province');
                            that.getAddress(result.entity.refProvinceId, 1, 'city');
                            that.getAddress(result.entity.refCityId, 2, 'area');
                            if (!that.setupFinancials) {
                                that.setupFinancials = [];
                                let obj = {
                                    finOrg: '',//金融机构1
                                    capType: '',//金融类型
                                    leader: '',//融资负责人
                                    sgCoopId: '',//融资主体
                                    financingType: '',//融资方式
                                    loanType: '',//贷款类型
                                    capAmount: '',//融资金额
                                    timeLimit: '',//融资期限
                                    capCost: '',//合同融资成本
                                    multiCost: '',//综合成本
                                    repayType: '',//还款方式
                                    needMemo: '',//附加条件
                                    bailMode: '',//增信方式
                                    capitalType: '',//资金用途
                                    repaySource: '',//还款来源
                                    willArrivalDate: '',//预计到账日期
                                    requires: '',//资金监管要求
                                }
                                that.setupFinancials.push(obj)
                            }
                        }
                    }
                });
            },
            save(type) {
                let that = this;
                let setupFinancials = that.setupFinancials
                for (let i = 0; i < setupFinancials.length; i++) {
                    if (!setupFinancials[i].finOrg) return that.error('请选择金融机构' + (i + 1) + '- 金融机构')
                    if (!setupFinancials[i].capType) return that.error('请输入金融机构' + (i + 1) + '- 金融类型')
                    if (!setupFinancials[i].leader) return that.error('请输入金融机构' + (i + 1) + '- 融资负责人')
                    if (!setupFinancials[i].sgCoopId) return that.error('请输入金融机构' + (i + 1) + '- 融资主体')
                    if (!setupFinancials[i].financingType) return that.error('请输入金融机构' + (i + 1) + '- 融资方式')
                    if (!setupFinancials[i].loanType) return that.error('请输入金融机构' + (i + 1) + '- 贷款类型')
                    if (!setupFinancials[i].capAmount) return that.error('请输入金融机构' + (i + 1) + '- 融资金额')
                    if (!setupFinancials[i].timeLimit) return that.error('请输入金融机构' + (i + 1) + '- 融资期限')
                    if (!setupFinancials[i].capCost) return that.error('请输入金融机构' + (i + 1) + '- 合同融资成本')
                    if (!setupFinancials[i].multiCost) return that.error('请输入金融机构' + (i + 1) + '- 综合成本')
                    if (!setupFinancials[i].repayType) return that.error('请输入金融机构' + (i + 1) + '- 还款方式')
                    if (!setupFinancials[i].needMemo) return that.error('请输入金融机构' + (i + 1) + '- 附加条件')
                    if (!setupFinancials[i].bailMode) return that.error('请输入金融机构' + (i + 1) + '- 增信方式')
                    if (!setupFinancials[i].capitalType) return that.error('请输入金融机构' + (i + 1) + '- 资金用途')
                    if (!setupFinancials[i].repaySource) return that.error('请输入金融机构' + (i + 1) + '- 还款来源')
                    if (!setupFinancials[i].willArrivalDate) return that.error('请输入金融机构' + (i + 1) + '- 预计到账日期')
                    if (!setupFinancials[i].requires) return that.error('请输入金融机构' + (i + 1) + '- 资金监管要求')
                }
                delete that.info.setupFinancials;
                let obj = {
                    setupFin: that.info,
                    fileAtt: fileArr,
                    setupFinancials: setupFinancials,
                };
                let str = JSON.stringify(obj).replace(/\"/g, '\\"');
                $.ajax({
                    type: 'post',
                    url: basePath + '/setupFin/saveOrEdit',  //请求数据接口
                    async: false,
                    data: {
                        bodyStr: str,
                        submitType: type,
                    },
                    success: function (result) {
                        if (result.success) {
                            that.$message({
                                message: '保存成功',
                                type: 'success'
                            });
                            // setTimeout(function () {
                            //     // 刷新首页
                            //     let index = window.parent.layui.admin.tabsPage.index
                            //     if (index == null) {
                            //         window.close();
                            //     } else {
                            //         var iframe = window.parent.layui.admin.tabsBody((index - 1)).find(".layadmin-iframe");
                            //         iframe[0].contentWindow.location.reload();
                            //         top.layui.admin.closeThisTabs(); // 关闭当前标签页
                            //     }
                            // }, 3000);
                        } else {
                            that.$message.error(result.msg);
                        }
                    }
                });

            },

            error(text) {
                this.$message({
                    message: text,
                    type: 'warning'
                });
            },
            // proSell/queryCoopInfo
            showFile(fileList) {
                if (fileList && fileList.length > 0) {
                    fileArr = fileList;
                    for (let i in fileList) {
                        let contractInfo = fileList[i];
                        let arr = contractInfo.split("|");
                        let imgSrc = "";
                        let suffix = arr[1].substring(arr[1].lastIndexOf(".") + 1, arr[1].length);
                        if (suffix == 'jpg' || suffix == 'png') {
                            imgSrc = "${fileHttpPre}/" + arr[3];
                        } else {
                            imgSrc = "${ctx}/resources/images/" + suffix + ".jpg";
                        }
                        $('#' + arr[0] + '-upload-more-list')
                            .append('<div class="layui-upload-img-div" id="upload_img_' + arr[2] + '"><img src="' + imgSrc + '" title="'
                                + arr[1] + '" class="layui-upload-img"><div class="mask"><a href="javascript:void(0)" onclick="showImg(\'' + "${fileHttpPre}"
                                + arr[3] + '\');">查看</a><a href="javascript:void(0)" onclick="del(\''
                                + arr[2] + '\')";>删除</a></div><p>' + arr[1] + '</p><input type="hidden" value="'
                                + contractInfo + '" id="fileAtt_' + arr[2] + '" name="fileAtts" ></input></div> ');
                    }
                }
            },


            queryProcessList() {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/capHistoryProcess/processList',  //请求数据接口
                    data: {processId: that.processId},
                    success: function (result) {
                        if (result.success) {
                            that.procNodeList = result.entity.procNodeList;
                            that.tempNodeList = result.entity.tempNodeList;
                        }
                    }
                });
            },
            audit(status) {
                let that = this;
                $.ajax({
                    type: 'post',
                    url: basePath + '/setupFin/auditProcess',  //请求数据接口
                    async: false,
                    data: {
                        id: that.id,
                        processId: that.processId,
                        status: status,
                        auditMsg: that.auditMsg
                    },
                    success: function (result) {
                        if (result.success) {
                            that.$message({
                                message: '操作成功',
                                type: 'success'
                            });
                            // setTimeout(function () {
                            //     // 刷新首页
                            //     let index = window.parent.layui.admin.tabsPage.index
                            //     if (index == null) {
                            //         window.close();
                            //     } else {
                            //         var iframe = window.parent.layui.admin.tabsBody((index - 1)).find(".layadmin-iframe");
                            //         iframe[0].contentWindow.location.reload();
                            //         top.layui.admin.closeThisTabs(); // 关闭当前标签页
                            //     }
                            // }, 3000);
                        } else {
                            that.$message.error('保存失败');
                        }
                    }
                });
            }
        }
    })
</script>
</body>
</html>
